import 'package:getx_scaffold/common/index.dart';

abstract class TimeUtils {
  static String formatDuration(Duration duration) {
    String twoDigits(int n) => n.toString().padLeft(2, '0');
    final minutes = twoDigits(duration.inMinutes.remainder(60));
    final seconds = twoDigits(duration.inSeconds.remainder(60));
    return '$minutes:$seconds';
  }

  /// format date by date str.
  /// dateStr 日期字符串
  static String formatDateStr(String dateStr) {
    return DateUtil.formatDateStr(dateStr, format: 'MM/dd HH:mm');
  }
}
